import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',
      hidden: true,
      meta: {
        peimission: ['pqf']
      },

      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
      children: [
        {
          path: 'Aa',
          name: 'Aa',
          hidden: true,
          component: () => import('../components/Aa.vue')
        }
      ]
    },
    {
      path: '/mouse',
      name: 'mouse',
      meta: {
        required: true
      },
      component: () => import('../views/Mouse.vue')
    },
    {
      path: '/pricticeHook',
      name: 'pricticeHook',
      meta: {
        required: true
      },
      component: () => import('../views/PricticeHook.vue')
    },
    {
      path: '/mobile',
      name: 'mobile',
      meta: {
        required: true
      },
      component: () => import('../components/Mobile.vue')
    },
    {
      path: '/virtualKeyboard',
      name: 'virtualKeyboard',
      meta: {
        required: true
      },
      component: () => import('../components/VirtualKeyboard.vue')
    },
    {
      path: '/tabSlide',
      name: 'tabSlide',
      meta: {
        required: true
      },
      component: () => import('../components/TabSlide.vue')
    },
    {
      path: '/vModel',
      name: 'vModel',
      meta: {
        required: true
      },
      component: () => import('../views/vModel/index.vue')
    },
    {
      path: '/loadMore',
      name: 'loadMore',
      meta: {
        required: true
      },
      component: () => import('../views/loadMore.vue')
    },
    {
      path: '/drag',
      name: 'drag',
      meta: {
        required: true
      },
      component: () => import('../views/drag.vue')
    }
  ]
})
router.beforeEach((to, from) => {
  console.log(to, from)
  return true
})
export default router
